﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using System.Data;

using Cisoft.Cisoft3G.BLL;
using Cisoft.Cisoft3G.Model;

public partial class Business_Cisoft3G_SmsStatistics : System.Web.UI.Page
{

    public static string name = string.Empty;

    public static string[] statusList = new string[4] { "0", "0", "0", "0" };
    public static string[] typeList = new string[9] { "0", "0", "0", "0", "0", "0", "0", "0", "0" };

    protected void Page_Load(object sender, EventArgs e)
    {
        ltScript.Text = "<script type=\"text/javascript\" src=\"../../js/My97DatePicker/WdatePicker.js\"></script>";
        imgStartDate.Attributes.Add("onclick", "WdatePicker({el:'txtStartTime'})");
        imgEndDate.Attributes.Add("onclick", "WdatePicker({el:'txtEndTime'})");

        if (!Page.IsPostBack)
        {
            BindSMSType();
            BindTD();

            txtStartTime.Text = DateTime.Now.ToShortDateString();
            txtEndTime.Text = DateTime.Now.ToShortDateString();
            btnSearch_Click(sender, e);

        }
    }

    #region 查看数据统计
    /// <summary>
    /// 查看数据统计
    /// </summary>
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        int typeCount = new SmsTypeBO().GetModelList("").Count;

        lblTitle.Text = txtStartTime.Text + "至" + txtEndTime.Text + ddlSearchType.SelectedItem.Text + "数据统计";

        lblDraft.Text = new Cisoft.Cisoft3G.BLL.DraftsBO().GetList("").Tables[0].Rows.Count.ToString();
        lblInbox.Text = new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + txtStartTime.Text + " 00:00:00' and IB_SendTime <= '" + txtEndTime.Text + "' ").Tables[0].Rows.Count.ToString();
        lblOutbox.Text = new Cisoft.Cisoft3G.BLL.OutboxBO().GetList("").Tables[0].Rows.Count.ToString();
        lblSent.Text = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + txtStartTime.Text + "' and ST_SentTime <= '" + txtEndTime.Text + " 23:59:59' ").Tables[0].Rows.Count.ToString();

        #region 短信状态
        if (ddlSearchType.SelectedIndex == 0)
        {
            trTitleRow.Visible = true;
            trDataRow.Visible = true;
            th1.Visible = true;
            th2.Visible = true;
            th3.Visible = true;
            th4.Visible = true;
            td1.Visible = true;
            td2.Visible = true;
            td3.Visible = true;
            td4.Visible = true;
            tr1.Visible = true;
            tr2.Visible = true;

            List<int> list = new List<int>();
            if (ddlSmsType.SelectedIndex == 0)
            {
                for (int i = 5; i < typeCount + 5; i++)
                {
                    HtmlTableCell th = this.form1.FindControl("th" + i) as HtmlTableCell;
                    HtmlTableCell td = this.form1.FindControl("td" + i) as HtmlTableCell;
                    th.Visible = true;
                    td.Visible = true;
                }
                for (int j = 5; j < typeCount+5; j++)
                {
                    int i = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + txtStartTime.Text + "' and ST_SentTime <= '" + txtEndTime.Text + "' and ST_SmsType ='" + ddlSmsType.Items[j - 4].Text + "' ").Tables[0].Rows.Count +
                            new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + txtStartTime.Text + "' and OB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + (j - 4).ToString()).Tables[0].Rows.Count +
                            new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + txtStartTime.Text + "' and IB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + (j - 4).ToString()).Tables[0].Rows.Count;
                    list.Add(i);
                }

                for (int k = 1; k <= typeCount; k++)
                {
                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                    lbl.Text = list[k - 1].ToString();
                }
            }
            if (ddlSmsType.SelectedIndex != 0)
            {
                for (int i = 5; i < typeCount + 5; i++)
                {
                    HtmlTableCell th = this.form1.FindControl("th" + i) as HtmlTableCell;
                    HtmlTableCell td = this.form1.FindControl("td" + i) as HtmlTableCell;
                    th.Visible = true;
                    td.Visible = true;
                }
                for (int i = 1; i < ddlSmsType.Items.Count; i++)
                {
                    Label lbl = this.form1.FindControl("Label" + i.ToString()) as Label;
                    if (ddlSmsType.Items[i].Selected)
                    {
                        lbl.Text = (new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + txtStartTime.Text + "' and IB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + i.ToString() + "").Tables[0].Rows.Count + 
                                                new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + txtStartTime.Text + "' and OB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + i.ToString() + "").Tables[0].Rows.Count + 
                                                new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + txtStartTime.Text + "' and ST_SentTime <= '" + txtEndTime.Text + "' and ST_SmsType ='" + ddlSmsType.Items[i].Text + "' ").Tables[0].Rows.Count).ToString();
                    }
                    else
	                {
                        lbl.Text = "0";
	                }
                }
            }
        }
        else
        {
            trTitleRow.Visible = true;
            trDataRow.Visible = true;
            tr1.Visible = true;
            tr2.Visible = true;
            for (int i = 1; i < ddlSearchType.Items.Count; i++)
            {
                HtmlTableCell th = this.form1.FindControl("th" + i) as HtmlTableCell;
                HtmlTableCell td = this.form1.FindControl("td" + i) as HtmlTableCell;
                if (i == ddlSearchType.SelectedIndex)
                {
                    th.Visible = true;
                    td.Visible = true;
                }
                else
                {
                    th.Visible = false;
                    td.Visible = false;
                }
            }
            if (ddlSmsType.SelectedIndex == 0)
            {
                for (int i = 5; i < typeCount + 5; i++)
                {
                    HtmlTableCell th = this.form1.FindControl("th" + i) as HtmlTableCell;
                    HtmlTableCell td = this.form1.FindControl("td" + i) as HtmlTableCell;
                    th.Visible = true;
                    td.Visible = true;
                }
                for (int i = 1; i < ddlSearchType.Items.Count; i++)
                {
                    if (ddlSearchType.Items[i].Selected)
                    {
                        switch (ddlSearchType.SelectedItem.Value)
                        {
                            case "CG_Drafts":
                                for (int k = 1; k <=typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;    
                                    if (lbl.ID.Replace("Label", "") == ddlSmsType.SelectedItem.Value)
                                    {
                                        lbl.Text = new Cisoft.Cisoft3G.BLL.DraftsBO().GetAllList().Tables[0].Rows.Count.ToString();
                                    }
                                    else
                                    {
                                        lbl.Text = "0";
                                    }
                                }
                                break;
                            case "CG_Inbox":
                                for (int k = 1; k <=typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                                    lbl.Text = new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + txtStartTime.Text + "' and IB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();
                                }
                                break;
                            case "CG_Outbox":
                                for (int k = 1; k <= typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                                    lbl.Text = new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + txtStartTime.Text + "' and OB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();
                                }
                                break;
                            case "CG_Sent":
                                for (int k = 1; k <= typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                                    lbl.Text = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + txtStartTime.Text + "' and ST_SentTime <= '" + txtEndTime.Text + "' and ST_SmsType ='" + ddlSmsType.Items[k].Text + "' ").Tables[0].Rows.Count.ToString();
                                }
                                break;
                        }
                    }
                }
            }
            if (ddlSmsType.SelectedIndex != 0)
            {
                for (int i = 5; i < typeCount + 5; i++)
                {
                    HtmlTableCell th = this.form1.FindControl("th" + i) as HtmlTableCell;
                    HtmlTableCell td = this.form1.FindControl("td" + i) as HtmlTableCell;
                    th.Visible = true;
                    td.Visible = true;
                }
                for (int i = 1; i < ddlSearchType.Items.Count; i++)
                {
                    if (ddlSearchType.Items[i].Selected)
                    {
                        switch (ddlSearchType.SelectedItem.Value)
                        {
                            case "CG_Drafts":
                                for (int k = 1; k <= typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                                    if (lbl.ID.Replace("Label", "") == ddlSmsType.SelectedItem.Value)
                                    {
                                        lbl.Text = new Cisoft.Cisoft3G.BLL.DraftsBO().GetAllList().Tables[0].Rows.Count.ToString();
                                    }
                                    else
                                    {
                                        lbl.Text = "0";
                                    }
                                }
                                break;
                            case "CG_Inbox":
                                for (int k = 1; k <= typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                                    if (lbl.ID.Replace("Label", "") == ddlSmsType.SelectedItem.Value)
                                    {
                                        lbl.Text = new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + txtStartTime.Text + "' and IB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();
                                    }
                                    else
                                    {
                                        lbl.Text = "0";
                                    }
                                }
                                break;
                            case "CG_Outbox":
                                for (int k = 1; k <= typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                                    if (lbl.ID.Replace("Label", "") == ddlSmsType.SelectedItem.Value)
                                    {
                                        lbl.Text = new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + txtStartTime.Text + "' and OB_SendTime <= '" + txtEndTime.Text + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();
                                    }
                                    else
                                    {
                                        lbl.Text = "0";
                                    }
                                }
                                break;
                            case "CG_Sent":
                                for (int k = 1; k <= typeCount; k++)
                                {
                                    Label lbl = this.form1.FindControl("Label" + k.ToString()) as Label;
                                    if (lbl.ID.Replace("Label", "") == ddlSmsType.SelectedItem.Value)
                                    {
                                        lbl.Text = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + txtStartTime.Text + "' and ST_SentTime <= '" + txtEndTime.Text + "' and ST_SmsType ='" + ddlSmsType.SelectedItem.Text + "' ").Tables[0].Rows.Count.ToString();
                                    }
                                    else
                                    {
                                        lbl.Text = "0";
                                    }
                                }
                                break;
                        }
                    }
                }
            }
        }
        #endregion 
    }
    #endregion

    #region 查看图表
    /// <summary>
    /// 查看图表
    /// </summary>
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        Response.Redirect("CountByDay.aspx");
    }
    #endregion

    #region 今天
    protected void Button1_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
        txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
        btnSearch_Click(sender, e);
    }
    #endregion
    #region 昨天
    protected void Button2_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
        txtEndTime.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
        btnSearch_Click(sender, e);
    }
    #endregion
    #region 本周
    protected void Button3_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.GetThisWeekendFirst();
        txtEndTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.GetThisWeekendLast();
        btnSearch_Click(sender, e);
    }
    #endregion 
    #region 上周
    protected void Button4_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.GetLastWeekendFirst();
        txtEndTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.GetLastWeekendLast();
        btnSearch_Click(sender, e);
    }
    #endregion
    #region 本月
    protected void Button5_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.FirstDayOfMonth().ToShortDateString();
        txtEndTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.LastDayOfMonth().ToShortDateString();
        btnSearch_Click(sender, e);
    }
    #endregion
    #region 上月
    protected void Button6_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.FirstDayOfMonth(DateTime.Now.AddMonths(-1)).ToShortDateString();
        txtEndTime.Text = Cisoft.IntegrationSystem.Common.DateTimeHelper.LastDayOfMonth(DateTime.Now.AddMonths(-1)).ToShortDateString();
        btnSearch_Click(sender, e);
    }
    #endregion
    #region 今年
    protected void Button7_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = DateTime.Now.Year.ToString() + "-01-01";
        txtEndTime.Text = DateTime.Now.Year.ToString() + "-12-31";
        btnSearch_Click(sender, e);
    }
    #endregion
    #region 去年
    protected void Button8_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = DateTime.Now.AddYears(-1).Year.ToString() + "-01-01";
        txtEndTime.Text = DateTime.Now.AddYears(-1).Year.ToString() + "-12-31";
        btnSearch_Click(sender, e);
    }
    #endregion
    #region 全部
    protected void Button9_Click(object sender, EventArgs e)
    {
        txtStartTime.Text = "1900-01-01";
        txtEndTime.Text = "2099-12-31";
        btnSearch_Click(sender, e);
    }
    #endregion

    #region 判断是否是汉字
    private bool IsChinses(string input)
    {
        Regex   r4   =   new   Regex(@"^[\u4e00-\u9fa5]+$");  
        return r4.IsMatch(input);
    }
    #endregion
    #region 导出Excel事件
    protected void btnExcel_Click(object sender, EventArgs e)
    {
        Bind(txtStartTime.Text, txtEndTime.Text, ddlSearchType.SelectedValue, ddlSmsType.SelectedValue);

        gvData.DataSource = CreateDataTable();
        gvData.DataBind();
        ShowExcel();
    }
    #endregion

    #region 自定义导出Excel
    #region 导出Excel
    public void ShowExcel()
    {
        Response.Clear();
        Response.Buffer = false;
        Response.Charset = "GB2312";
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(Server.HtmlDecode(lblTitle.Text), System.Text.Encoding.UTF8) + ".xls");

        Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
        Response.ContentType = "application/ms-excel";
        Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=GB2312\">");
        this.EnableViewState = false;
        System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
        HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);
        gvData.RenderControl(oHtmlTextWriter);
        Response.Write(oStringWriter.ToString());
        Response.End();
    }
    #endregion

    #region 绑定数据
    private void Bind(string st, string et, string status, string type)
    {
        int typeCount = new SmsTypeBO().GetModelList("").Count;

        statusList[3] = new Cisoft.Cisoft3G.BLL.DraftsBO().GetList("").Tables[0].Rows.Count.ToString();
        statusList[0] = new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + st + "' and IB_SendTime <= '" + et + "' ").Tables[0].Rows.Count.ToString();
        statusList[2] = new Cisoft.Cisoft3G.BLL.OutboxBO().GetList("").Tables[0].Rows.Count.ToString();
        statusList[1] = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + st + "' and ST_SentTime <= '" + et + "' ").Tables[0].Rows.Count.ToString();

        if (status == "0")
        {
            if (type == "0")
            {
                for (int j = 1; j <= typeCount; j++)
                {
                    int i = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + st + "' and ST_SentTime <= '" + et + "' and ST_SmsType ='" + new Cisoft.Cisoft3G.BLL.SmsTypeBO().GetModel(j).ST_TypeName + "' ").Tables[0].Rows.Count +
                            new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + st + "' and OB_SendTime <= '" + et + "' and RT_Type_FK =" + j.ToString()).Tables[0].Rows.Count +
                            new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + st + "' and IB_SendTime <= '" + et + "' and RT_Type_FK =" + j.ToString()).Tables[0].Rows.Count;
                    typeList[j - 1] = i.ToString();
                }
            }
            if (type != "0")
            {
                for (int i = 1; i <= typeCount; i++)
                {

                    int j = (new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + st + "' and IB_SendTime <= '" + et + "' and RT_Type_FK =" + i.ToString() + "").Tables[0].Rows.Count +
                                    new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + st + "' and OB_SendTime <= '" + et + "' and RT_Type_FK =" + i.ToString() + "").Tables[0].Rows.Count +
                                    new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + st + "' and ST_SentTime <= '" + et + "' and ST_SmsType ='" + new Cisoft.Cisoft3G.BLL.SmsTypeBO().GetModel(i).ST_TypeName + "' ").Tables[0].Rows.Count);
                    typeList[i - 1] = j.ToString();
                }
            }
        }
        else
        {
            if (type == "0")
            {
                for (int i = 1; i < 5; i++)
                {
                    switch (status)
                    {
                        case "CG_Drafts":
                            for (int k = 1; k <= typeCount; k++)
                            {
                                typeList[i - 1] = new Cisoft.Cisoft3G.BLL.DraftsBO().GetAllList().Tables[0].Rows.Count.ToString();
                            }
                            break;
                        case "CG_Inbox":
                            for (int k = 1; k <= typeCount; k++)
                            {
                                typeList[i - 1] = new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + st + "' and IB_SendTime <= '" + et + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();
                            }
                            break;
                        case "CG_Outbox":
                            for (int k = 1; k <= typeCount; k++)
                            {
                                typeList[i - 1] = new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + st + "' and OB_SendTime <= '" + et + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();
                            }
                            break;
                        case "CG_Sent":
                            for (int k = 1; k <= typeCount; k++)
                            {
                                typeList[i - 1] = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + st + "' and ST_SentTime <= '" + et + "' and ST_SmsType ='" + new Cisoft.Cisoft3G.BLL.SmsTypeBO().GetModel(k).ST_TypeName + "' ").Tables[0].Rows.Count.ToString();
                            }
                            break;
                    }
                }
            }
            if (type != "0")
            {
                switch (status)
                {
                    case "CG_Drafts":
                        for (int k = 1; k <= typeCount; k++)
                        {
                            typeList[k - 1] = new Cisoft.Cisoft3G.BLL.DraftsBO().GetAllList().Tables[0].Rows.Count.ToString();
                        }
                        break;
                    case "CG_Inbox":
                        for (int k = 1; k <= typeCount; k++)
                        {
                            typeList[k - 1] = new Cisoft.Cisoft3G.BLL.InboxBO().GetList(" IB_SendTime >= '" + st + "' and IB_SendTime <= '" + et + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();
                        }
                        break;
                    case "CG_Outbox":
                        for (int k = 1; k <= typeCount; k++)
                        {
                            typeList[k - 1] = new Cisoft.Cisoft3G.BLL.OutboxBO().GetList(" OB_SendTime >= '" + st + "' and OB_SendTime <= '" + et + "' and RT_Type_FK =" + k.ToString()).Tables[0].Rows.Count.ToString();

                        }
                        break;
                    case "CG_Sent":
                        for (int k = 1; k <= typeCount; k++)
                        {
                            typeList[k - 1] = new Cisoft.Cisoft3G.BLL.SentBO().GetList(" ST_SentTime >= '" + st + "' and ST_SentTime <= '" + et + "' and ST_SmsType ='" + new Cisoft.Cisoft3G.BLL.SmsTypeBO().GetModel(k).ST_TypeName + "' ").Tables[0].Rows.Count.ToString();
                        }
                        break;
                }
            }
        }
    }
    #endregion

    #region 自定义DataTable
    private DataTable CreateDataTable()
    {
        DataTable dt = new DataTable();

        DataColumn dc1 = new DataColumn("短信接收条数");
        DataColumn dc2 = new DataColumn("短信发送条数");
        DataColumn dc3 = new DataColumn("待发短信条数");
        DataColumn dc4 = new DataColumn("草稿箱草稿数量");
        //DataColumn dc5 = new DataColumn("普通");
        //DataColumn dc6 = new DataColumn("通知");
        //DataColumn dc7 = new DataColumn("公告");
        //DataColumn dc8 = new DataColumn("投票");
        //DataColumn dc9 = new DataColumn("抽奖");
        //DataColumn dc10 = new DataColumn("意见");
        //DataColumn dc11 = new DataColumn("投诉");
        //DataColumn dc12 = new DataColumn("提醒");
        //DataColumn dc13 = new DataColumn("答题");

        dt.Columns.Add(dc1);
        dt.Columns.Add(dc2);
        dt.Columns.Add(dc3);
        dt.Columns.Add(dc4);

        foreach (SmsTypeMO model in new SmsTypeBO().GetModelList(""))
        {
            dt.Columns.Add(new DataColumn(model.ST_TypeName));
        }

        //dt.Columns.Add(dc5);
        //dt.Columns.Add(dc6);
        //dt.Columns.Add(dc7);
        //dt.Columns.Add(dc8);
        //dt.Columns.Add(dc9);
        //dt.Columns.Add(dc10);
        //dt.Columns.Add(dc11);
        //dt.Columns.Add(dc12);
        //dt.Columns.Add(dc13);

        DataRow row = dt.NewRow();
        object[] obs = new object[12]{statusList[0],statusList[1],statusList[2],statusList[3],typeList[0],
                   typeList[1],typeList[2],typeList[3],typeList[4],typeList[5],typeList[6],typeList[7]};
        row.ItemArray = obs;
        dt.Rows.Add(row);
        return dt;
    }
    #endregion

    public override void VerifyRenderingInServerForm(Control control)
    {
    }
    #endregion

    #region 绑定短信类型
    private void BindSMSType()
    {
        List<SmsTypeMO> list = new SmsTypeBO().GetModelList("");
        if (list.Count > 0)
        {
            foreach (SmsTypeMO model in list)
            {
                ddlSmsType.Items.Add(new ListItem(model.ST_TypeName, model.ST_TypeID.ToString()));
            }
        }
    }
    private void BindTD()
    {
        for (int i = 1; i < 9; i++)
        {
            HtmlGenericControl span = table1.FindControl("span" + i.ToString()) as HtmlGenericControl;
            SmsTypeMO model = new SmsTypeBO().GetModel(i);
            if (model != null)
            {
                span.InnerText = model.ST_TypeName;
            }
        }
    }
    #endregion
}
